import 'package:flutter/material.dart';

/*
ConstrainedBox嵌套情况，对于minWidth和minHeight来说，取父子中相应数值较大得。
 */
class Exam_16 extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: AppBar(
        title: Text("尺寸限制类容器"),
      ),
      body: Content(),
    );
  }
  
}



class Content extends StatelessWidget{

  Widget redBox = DecoratedBox(decoration: BoxDecoration(color: Colors.red));

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Column(
      children: <Widget>[
        ConstrainedBox(
          constraints: BoxConstraints(
            minHeight: 50.0,//最小高度是50像素,
            minWidth: double.infinity, //宽度尽可能大
          ),
          child: Container(
            height: 10.0,
            child:redBox
          ),
        ),
        Text(" - - - - - - - - "),
        SizedBox(
          width: 80.0,
          height: 80.0,
          child: redBox,
        ),
      ],
    );
  }

}